import os
import autowaf

VALARIBBON_VERSION = "0.1.0"

VERSION = VALARIBBON_VERSION
VERSION_MAJOR_MINOR = ".".join(VERSION.split(".")[0:2])
APPNAME = 'valaribbon'

srcdir = '.'
blddir = 'build'

def init():
    pass

def set_options(opt):
    autowaf.set_options(opt)
    opt.tool_options('compiler_cc')

def configure(conf):
    autowaf.configure(conf)
    conf.check_tool('compiler_cc cc')
    conf.check_tool('vala')

    min_vala_version = (0, 7, 3)
    if conf.env['VALAC_VERSION'] < min_vala_version:
        conf.fatal('Your vala compiler version ' + str(conf.env['VALAC_VERSION']) +
                   ' is too old. The project requires at least version %d.%d.%d' % min_vala_version );

    autowaf.check_pkg(conf, 'gtk+-2.0',   uselib_store='GTK',        atleast_version='2.10.0', mandatory=True)
    autowaf.check_pkg(conf, 'pangocairo', uselib_store='PANGOCAIRO', atleast_version='1.24.0', mandatory=True)
    autowaf.check_pkg(conf, 'gee-1.0',    uselib_store='GEE',        atleast_version='0.1.5',  mandatory=True)

    conf.env['CCFLAGS'] = ['-std=c99']

def build(bld):
    autowaf.build_pc(bld, 'VALARIBBON', VERSION, ['GTK', 'PANGOCAIRO', 'GEE'])
    bld.add_subdirs('valaribbon')

def shutdown():
    pass

